package edu.study.api.common.enums;

import lombok.Getter;

@Getter
public enum RoleTypeEnum implements BaseStrEnum {

    ROOT("ROOT", "超级管理员"),
    ADMIN("ADMIN", "管理员"),
	TEACHER("TEACHER", "老师"),
	STUDENT("STUDENT", "学生"),
    OTHER("OTHER", "其他");

    private String code;
    private String message;

    RoleTypeEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public static RoleTypeEnum parseCode(String code) {
        for (RoleTypeEnum result : values()) {
            if (result.getCode().equals(code)) {
                return result;
            }
        }
        return null;
    }
    
    public static String getMessageFromCode(String code) {
        for (RoleTypeEnum result : values()) {
            if (result.getCode().equals(code)) {
                return result.getMessage();
            }
        }
        return null;
    }
}
